home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / challenge / 13.07 / Challenge.sit / Challenge, Polygon Projection / Challenge.h next >
Text File  |  1997-05-07  |  2KB  |  55 lines

  1. #ifndef __CHALLENGE_H__
  2. #define __CHALLENGE_H__
  3.  
  4. #include <QDOffscreen.h>
  5.  
  6. #define kMAXPOINTS 10
  7.  
  8. typedef struct My2DPoint {  /* point in z==0 plane */
  9.   float x2D;                /* x coordinate */
  10.   float y2D;                /* y coordinate */
  11. } My2DPoint;
  12.  
  13. typedef struct My3DPoint {
  14.   float x3D;                /* x coordinate */
  15.   float y3D;                /* y coordinate */
  16.   float z3D;                /* z coordinate */
  17. } My3DPoint;
  18.  
  19. typedef struct My3DDirection {
  20.   float thetaX;             /* angle in radians */
  21.   float thetaY;             /* angle in radians */
  22.   float thetaZ;             /* angle in radians */
  23. } My3DDirection;
  24.  
  25. typedef struct MyPlane {
  26.   My3DDirection  planeNormal;     /* normal vector to plane */
  27.   My3DPoint        planeOrigin;   /* origin of plane in 3D space */
  28. } MyPlane;
  29.  
  30. typedef struct MyPolygon {
  31.   long       numPoints;      /* number of points in polygon */
  32.   My2DPoint  thePoint[kMAXPOINTS];  /* polygon in z==0 plane */
  33.   MyPlane    polyPlane;      /* rotate/translate z==0 plane to this plane */
  34.   RGBColor   polyColor;       /* the color to draw this polygon */
  35. } MyPolygon;
  36.  
  37. pascal void InitProjection(
  38.   My3DPoint    *viewPoint,   /* viewpoint from which to project */
  39.   My3DPoint    *illumPoint,  /* viewpoint from which to draw shadow */
  40.   void         *storage,     /* auxiliary storage preallocated for your use */
  41.   long         storageSize   /* number of bytes of storage */
  42. );
  43.  
  44. pascal void CalcProjection(
  45.   GWorldPtr    offScreen,    /* GWorld to draw projection */
  46.   MyPolygon    thePolys[],   /* polygons to project */
  47.   long         numPolys,     /* number of polygons to project */
  48.   My3DPoint    *viewPoint,   /* viewpoint from which to project */
  49.   My3DPoint    *illumPoint,  /* illumination point from which to draw shadow */
  50.   void         *storage,     /* auxiliary storage preallocated for your use */
  51.   long         storageSize   /* number of bytes of storage */
  52. );
  53.  
  54. #endif
  55.